
package ProOF.apl.problems.real.functions;

import ProOF.com.LinkerParameters;
import java.lang.Math;
/**
 *
 * @author Lucas
 */
public class RealFuncKL extends aRealFunction{
	
	private double a[] = {0.1957, 0.1947, 0.1735, 0.16, 0.0844, 0.0627, 0.0456, 0.0342, 0.0323, 0.0235, 0.0246};
	private double b[] = {0.25, 0.5, 1.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0, 16.0};
	@Override
	public void parameters(LinkerParameters link) throws Exception {

	}
	
	@Override
	public int dimension() {
		return 4;
	}
	
	@Override
	public double min( int i ) {
		return 0;
	}
	
	@Override
	public double max( int i ) {
		return 0.42;
	}

	@Override
	public double f(double[] x) throws Exception {
		check(x);
		double sum = 0;
		for (int i = 0; i < 11; i++) {
			sum += Math.pow((a[i]- (x[0]*(1+b[i]*x[1])/(1+ x[2]*b[i] +x[3]*b[i]*b[i]))), 2);
		}
		
		return sum;
	}

	@Override
	public String name() {
		return "KL";
	}

	@Override
	public String description() {
		return "Kowalik Problem";
	}	
}
